<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/web/header.jsp"%>
<title>修改信息</title>
</head>
<body>
<fieldset class="layui-elem-field" style="margin: 25px;">
		<legend>信息维护-添加信息</legend>
		<div class="layui-field-box">
			<form class="layui-form" lay-filter="formA" method="post">
				<div class="layui-form-item">
					<label class="layui-form-label">部门编号</label>
					<div class="layui-input-block">
						<input type="text" name="code" lay-verify="required"
							style="width: 200px;" placeholder="部门编号" readonly autocomplete="off"
							class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">部门名称</label>
					<div class="layui-input-block">
						<input type="text" name="name" lay-verify="required"
							style="width: 200px;" placeholder="部门名称" autocomplete="off"
							class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">部门电话</label>
					<div class="layui-input-block">
						<input type="text" name="tel" lay-verify="required"
							style="width: 200px;" placeholder="部门电话" autocomplete="off"
							class="layui-input">
					</div>
				</div>
				<div style="width: 68%; margin: auto;">
					<div class="layui-input-inline" >
						<input type="button" class="layui-btn"  lay-submit
							lay-filter="upd" value="修改">
					</div>
					<div class="layui-input-inline">
						<input type="button" class="layui-btn" onclick="closeThis()"
							value="取消">
					</div>
					<div class="layui-input-inline">
						<input type="reset" class="layui-btn layui-btn-primary">
					</div>
				</div>
				<input type="hidden" name="action" value="upd">
			</form>
		</div>

	</fieldset>
<script type="text/javascript">
var code='<%=request.getParameter("code")%>';
init();
function init(){
	 ajax('/department',{action:"get",code:code},'json',function(data){
		
		 form.val("formA",{code:data.code,name:data.name,tel:data.tel})
	 })
}
formSubmit('/department','submit(upd)','text',function(data){
	console.log(data)
	if(data==1){
		layer.msg("修改成功",{time:1000},closeThis)
	}else{
		layer.msg("修改失败")
	}
})
</script>
</body>
</html>